<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>系统公告</title>
	<link rel="stylesheet" href="../../layui/css/layui.css">
	<!-- 样式 -->
	<link rel="stylesheet" href="../../css/style.css" />
	<!-- 主题（主要颜色设置） -->
	<link rel="stylesheet" href="../../css/theme.css" />
	<!-- 通用的css -->
	<link rel="stylesheet" href="../../css/common.css" />
</head>
<style>
	body {
		font-family: 'Arial', sans-serif;
		background: linear-gradient(135deg, #f0f8ff, #e6ffe6); /* 渐变背景 */
		color: #333;
		margin: 0;
		padding: 0;
	}

	#swiper {
		overflow: hidden;
		border-radius: 10px;
		box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
		margin-bottom: 20px;
		background-color: #fff; /* 轮播图背景色 */
	}

	#swiper .layui-carousel-ind li {
		width: 16px;
		height: 10px;
		border-radius: 20px;
		background-color: #f7f7f7;
	}

	#swiper .layui-carousel-ind li.layui-this {
		width: 30px;
		background-color: #409EFF;
	}

	.index-title {
		text-align: center;
		padding: 20px;
		background-color: #fff;
		border-radius: 10px;
		box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
		margin: 20px auto;
		max-width: 980px;
		font-size: 24px;
		color: #333;
	}

	.news-container {
		max-width: 980px;
		margin: 0 auto;
		background-color: #fff;
		padding: 20px;
		border-radius: 10px;
		box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
	}

	.news-container .title {
		font-size: 28px;
		color: #333;
		margin-bottom: 10px;
	}

	.news-container .auth-container {
		font-size: 14px;
		color: #999;
		margin-bottom: 20px;
	}

	.news-container .content {
		font-size: 16px;
		line-height: 1.6;
		color: #333;
		margin-bottom: 20px;
	}

	.news-container .btn-container {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 20px;
	}

	.news-container .btn-container .title {
		font-size: 16px;
		color: #999;
	}

	.news-container .btn-container button {
		padding: 10px 20px;
		background: linear-gradient(135deg, #66b1ff, #409EFF); /* 按钮渐变背景 */
		color: #fff;
		border: none;
		border-radius: 5px;
		cursor: pointer;
		transition: background 0.3s;
	}

	.news-container .btn-container button:hover {
		background: linear-gradient(135deg, #409EFF, #66b1ff); /* 悬停渐变背景 */
	}

	@media (max-width: 768px) {
		.index-title, .news-container {
			padding: 10px;
		}

		.news-container .title {
			font-size: 24px;
		}

		.news-container .content {
			font-size: 14px;
		}
	}
</style>
<body style="padding-bottom: 10px;">

<div id="app">
	<div class="index-title">
		<span style="color: #666;">NEWS / INFORMATION</span><br>
		<span style="color: #333; font-weight: bold;">系统公告</span>
	</div>

	<div class="news-container">
		<h1 class="title">{{detail.title}}</h1>
		<div class="auth-container">
			时间：{{detail.addtime}}
		</div>
		<div class="content" v-html="detail.content">
		</div>

		<div class="btn-container">
			<div class="title">
				本篇文章：{{detail.title}}
			</div>
			<button @click="back()" type="button">
				<i class="layui-icon">&#xe65c;</i> 返回列表
			</button>
		</div>
	</div>
</div>

<!-- layui -->
<script src="../../layui/layui.js"></script>
<!-- vue -->
<script src="../../js/vue.js"></script>
<!-- 组件配置信息 -->
<script src="../../js/config.js"></script>
<!-- 扩展插件配置信息 -->
<script src="../../modules/config.js"></script>
<!-- 工具方法 -->
<script src="../../js/utils.js"></script>

<script>
	var vue = new Vue({
		el: '#app',
		data: {
			// 轮播图
			swiperList: [{
				img: '../../img/banner.jpg'
			}],
			detail: {}
		},
		methods: {
			jump(url) {
				jump(url)
			},
			back() {
				window.history.back();
			}
		}
	})

	layui.use(['layer', 'element', 'carousel', 'laypage', 'http', 'jquery'], function() {
		var layer = layui.layer;
		var element = layui.element;
		var carousel = layui.carousel;
		var laypage = layui.laypage;
		var http = layui.http;
		var jquery = layui.jquery;

		var id = http.getParam('id');

		// 获取轮播图 数据
		http.request('config/list', 'get', {
			page: 1,
			limit: 5
		}, function(res) {
			if (res.data.list.length > 0) {
				var swiperItemHtml = '';
				for (let item of res.data.list) {
					if (item.name.indexOf('picture') >= 0 && item.value && item.value != "" && item.value != null) {
						swiperItemHtml +=
								'<div>' +
								'<img style="width: 100%;height: 100%;object-fit:cover;" class="swiper-item" src="' + item.value + '">' +
								'</div>';
					}
				}
				jquery('#swiper-item').html(swiperItemHtml);
				// 轮播图
				vue.$nextTick(() => {
					carousel.render({
						elem: '#swiper',
						width: '100%',
						height: '430px',
						arrow: 'hover',
						anim: 'default',
						autoplay: 'true',
						interval: '3000',
						indicator: 'inside'
					});
				})
			}
		});

		// 详情信息
		http.request('news/info/' + id, 'get', {}, function(res) {
			vue.detail = res.data
		});

	});
</script>
</body>
</html>